//
//  YDDatabaseController.m
//  YDBASE
//
//  Created by wangyd on 2021/12/22.
//  Copyright © 2021 wuyezhiguhun. All rights reserved.
//

#import "YDDatabaseController.h"

#import "YDFMDB.h"
#import "YDFMDBDatabaseQueue.h"

@interface YDDatabaseController ()

@end

@implementation YDDatabaseController

- (void)viewDidLoad {
    [super viewDidLoad];

    //[self fmdbDatabaseOperation];
    
    [self fmdbDatabaseQueueOperation];
}

- (void)fmdbDatabaseOperation {
    
    YDFMDB *ydFMDB = [[YDFMDB alloc] init];
//    //创建数据库
//    [ydFMDB newFMDBDatabase];
//    //创建数据库表
//    [ydFMDB newFMDBDatabaseCreateTableWithName:@"user"];
//    //插入数据
    [ydFMDB insertIntoFMDBDatabaseWithName:@"赵钱孙" age:@"20"];
    
    //数据库修改
//    [ydFMDB updateFMDBDatabaseWithUserName:@"宋  轶"];
    
    //查询数据库
    [ydFMDB selectFMDBDatabaseWithTableAll];
    
    //删除数据
    [ydFMDB deleteFMDBDatabaseWithUserName:@"赵钱孙"];
    
    //查询数据库
    [ydFMDB selectFMDBDatabaseWithTableAll];
}

- (void)fmdbDatabaseQueueOperation {
    
    YDFMDBDatabaseQueue *databaseQueue = [[YDFMDBDatabaseQueue alloc] init];
    
    [databaseQueue insertFMDBDatabaseList];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
